<template>
  <div>
    <van-swipe-cell v-for="(item,$index) in data" :key="$index">
      <van-card
        :title="item.corpName"
        class="van-swiper-cell-box"
        @click="goToDetail(item)"
      >
      <template #thumb>
        <img src="../../assets/img/corp-002.jpg" alt="" style="width:88px;height:88px">
      </template>
        <template #desc>
          <van-row>
            状态：
            <van-tag round :type="statusColor[item.dataStatus]">{{item.dataStatus | statusFilter}}</van-tag>
          </van-row>
          <van-row type="flex" justify="space-between">
            <van-col span="16">联系人：{{item.contacter}}</van-col>
            <van-col span="8">{{item.contactPhone}}</van-col>
          </van-row>
          <van-row>
            <van-col span="6">经营地址：</van-col>
            <van-col span="18">{{item.businessAddr}}</van-col>
          </van-row>
          <van-row>
            <van-col span="6">邮寄地址：</van-col>
            <van-col span="18">{{item.postAddr}}</van-col>
          </van-row>
        </template>
      </van-card>
    </van-swipe-cell>
  </div>
</template>

<script>
import Vue from "vue";
import { SwipeCell } from "vant";
Vue.use(SwipeCell);
// 表单配置
import { enterpriseInfoForm } from "../../components/form/config";
export default {
  name: "carDetail",
  props: {
    data: {
      type: Array,
      default: []
    }
  },
  data() {
    return {
      statusColor: {
        0: "warning",
        1: "primary",
        2: "success",
        3: "danger"
      }
    };
  },
  filters: {
    statusFilter: function(val) {
      switch (val) {
        case 0:
          return "待确认";
        case 1:
          return "待审核";
        case 2:
          return "已审核";
        case 3:
          return "审核失败";
      }
    }
  },
  methods: {
    goToDetail(val) {
      this.$router.push({
        name: "enterpriseDetail",
        query:{type:val.dataStatus},
        params: { form: enterpriseInfoForm(val),isModify:true,name:"enterpriseInfo"}
      });
    }
  }
};
</script>

<style lang="less" scoped>
.van-swiper-cell-box {
  background-color: #fff;
  &::after {
    content: "";
    position: absolute;
    pointer-events: none;
    right: 0;
    bottom: 0;
    left: 16px;
    border-bottom: 1px solid #ebedf0;
    transform: scaleY(0.5);
    box-sizing: border-box;
  }
}
</style>
